//
//  EFengComposePhotoView.m
//  WZEfengAndEtong
//
//  Created by wanzhao on 16/3/3.
//  Copyright © 2016年 wanzhao. All rights reserved.
//

#import "EFengComposePhotoView.h"

@interface EFengComposePhotoView ()


@end

@implementation EFengComposePhotoView
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.userInteractionEnabled = YES;
        
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        [btn setImage:[UIImage imageNamed:@"share_button-delete"] forState:UIControlStateNormal];
        [btn addTarget:self action:@selector(delButtonDidClick) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:btn];
        self.delButton = btn;

    }
    return self;
}

- (void)delButtonDidClick
{
    if (self.eFengComposePhotoViewDelegate != nil && [self.eFengComposePhotoViewDelegate respondsToSelector:@selector(eFengComposePhotoViewDidClickDeleteWithPhotoTag:)]) {
        [self.eFengComposePhotoViewDelegate eFengComposePhotoViewDidClickDeleteWithPhotoTag:self.tag];
    }
}


- (void)layoutSubviews
{
    [super layoutSubviews];
    self.delButton.frame = CGRectMake(self.width - self.delButton.currentImage.size.width, 0, self.delButton.currentImage.size.width, self.delButton.currentImage.size.height);
}

@end
